1. Field of the Invention
This invention relates to a storage device and an emulation processing method for accessing a storage medium having a first sector length unit by a command with a second sector length unit that is shorter than the first sector length unit, and more particularly to a storage device and an emulation processing method for the storage device for protecting data of an address other than the target address from a write error.
2. Description of the Related Art
As host performance improves, the capacity of storage media, such as disks, is doubling every year. Due to this increase in capacity of the storage medium, the sector length has become longer. However, there are some host OS that do not correspond to the change in sector length. Therefore, emulation technology, that can size-convert to the sector length units of the storage medium by a command with a sector length of the host OS, is necessary.
For a disk such as an optical disk, reading and writing is performed in sector units. This sector is broken up by a sector ID, and is set a user area (data area) having a specified length. For example, a sector length of 512 bytes is mainstream. However, with the recent demand for larger capacity disks, disks with a sector length of 1024 bytes or 2048 bytes are now provided. Increasing the sector length in this way makes it possible to increase the user area, and thus increase the disk capacity.
On the other hand, the OS (file system) that uses this disk defines the sector size and specifies the address. For example, in the UNIX system, the recognized sector size is 512 bytes. In a file system such as UNIX, a 512-byte sector size disk was used. However, it is desired to be able to use large-capacity disks (2048 bytes) as mentioned above with a file system such as UNIX as well.
In order to use a 2048-byte sector disk in this environment with a 512-byte sector, so-called emulation technology that converts the sector size has been proposed (for example, Japanese Unexamined published patent No. H4-165527, U.S. Pat. No. 5,485,439, Japanese Unexamined published patent No. H4-14127 and Japanese Unexamined published patent No. H9-146710). FIG. 10 and FIG. 11 explain this prior emulation process.
FIG. 10 shows a file system that uses a magneto-optical disk device 91 in which the disk medium 92 stores data in sector length units of 2048 bytes (first sector length). On the other hand, the OS of the host 90 accesses a file in 512-byte units (second sector length). The relationship between the sectors recognized by this host and the actual sector size of the disk is as shown in FIG. 11. In other words, the sector addresses of the host for the actual sectors of sector address ‘a’ of the disk are: 4a, 4a+1, 4a+2 and 4a+3.
Conversion of this sector size is performed as follows. First, the sector address from the host 90 is converted to the actual sector size of the disk 92. For example, when host sector addresses ‘4a+1’ to ‘4b+2’ are received from the host 90, they are converted to actual sector addresses ‘a’ and ‘a+1’ of the disk 92. And the sector data of this actual sector address is read to a buffer 93 from the disk 92 (this is called staging).
In response to a read command, data of the specified host sector addresses ‘4a+1’ to ‘4b+2’ are obtained from the read sectors ‘a’ and ‘a+1’, and transferred to the host 90.
On the other hand, in response to a write command, this staged sector data ‘a’ and ‘a+1’ are updated by write data of the host sector addresses ‘4a+1’ to ‘4b+2’. Next, the updated data are written to the disk 92 in actual sector units ‘a’ and ‘a+1’.
In this way, the emulation operation reads the data of the address before and after that of the target address and updates it. When a write error occurs when writing to the disk 92, an alternate sector process is performed the same as in normal disk control. Generally, the objective of the alternate process is to save the host data without the assumption of a retry from the host. Therefore, conventionally, the write data from the host is written in an alternate area of the disk 92. For example, as shown in FIG. 11, when a write error occurs in the write data from host sector address ‘4a+2’, the 2048-byte data of the sector address ‘a’ of this drive is saved in an alternate area.
However, in the prior alternate processing, when writing of alternation does not end normally, a retry operation called alternation is performed. However even in that case when all writing does not end normally, the writing process ends in error and processing ends without all of the data being written.
Therefore, there is the problem that all of the data of that sector of the disk is lost from the drive and medium. Particularly in the emulation process, there is the problem that data of an address that is not the target for writing is deleted.